package com.iseastar.guojiang.team.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.iseastar.guojiang.BaseFragment;
import com.iseastar.guojiang.view.AppTab1;
import com.shouhuobao.station.R;

import droid.frame.ui.utils.Utils;
import droid.frame.view.ViewPagerExt;

/**
 * 本省
 * Created by lidandan on 2018/6/14.
 */
public class CourierThisProvinceFragment extends BaseFragment {

    private BaseFragment mFragment1, mFragment2, mFragment3, mFragment4;

    @Override
    protected void findViewById() {
        setContentView(R.layout.fragment_courier_this_province);
        super.findViewById();
        TextView[] mTags = new TextView[4];
        mTags[0] = (TextView) findViewById(R.id.courier_this_province_tab1);
        mTags[1] = (TextView) findViewById(R.id.courier_this_province_tab2);
        mTags[2] = (TextView) findViewById(R.id.courier_this_province_tab3);
        mTags[3] = (TextView) findViewById(R.id.courier_this_province_tab4);
        initFragment();

        ViewPagerExt mViewPager = (ViewPagerExt) findViewById(R.id.child_this_province_pager);
        ImageView mImgLine = (ImageView) findViewById(R.id.line_img);
        mViewPager.setFragmentItems(getChildFragmentManager(), mFragment1, mFragment2, mFragment3, mFragment4);
        mViewPager.setSupportScroll(true);
        AppTab1 appTab = new AppTab1(getActivityContext(), Utils.dpToPx(30, getResources()));
        appTab.setTextColor(getResources().getColor(R.color.app_theme_color1), Color.parseColor("#C7C7CC"));
        appTab.initPosition(mViewPager, mImgLine, mTags);

        mViewPager.setCurrentItem(0, true);
        mViewPager.setOffscreenPageLimit(mTags.length);
    }

    private void initFragment() {
        mFragment1 = new CourierThisProvinceRankingListFragment();
        Bundle bundle1 = new Bundle();
        bundle1.putInt("type", 0);
        mFragment1.setArguments(bundle1);
        //
        Bundle bundle2 = new Bundle();
        bundle2.putInt("type", 1);
        mFragment2 = new CourierThisProvinceRankingListFragment();
        mFragment2.setArguments(bundle2);
        //
        Bundle bundle3 = new Bundle();
        bundle3.putInt("type", 2);
        mFragment3 = new CourierThisProvinceRankingListFragment();
        mFragment3.setArguments(bundle3);

        Bundle bundle4 = new Bundle();
        bundle4.putInt("type", 3);
        mFragment4 = new CourierThisProvinceRankingListFragment();
        mFragment4.setArguments(bundle4);
    }
}
